﻿using System;
using AppCommon;
using Controller;

public partial class Modules_PanoramaSmallHomeControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindDataTourDocDao();
            // BindQuangCaoVYC1();
        }
    }

    public void BindDataTourDocDao()
    {
        try
        {
            var controller = new VYC01Controller();
            var list = controller.GetListTourDocDao();
            if (list.Count > 0)
            {
                // 
                imgFirstTour.ImageUrl = Constants.UPLOAD_TOUR + list[0].AnhDaiDien;
                linkFirstTour.NavigateUrl = "~/tour/" + list[0].UniqueId;
                litTitleFirstTour.Text = list[0].TieuDe;
                litNgaydi.Text = list[0].NgayDi.ToString("dd/MM/yyyy");
                litTime.Text = (list[0].NgayDen - list[0].NgayDi).TotalDays.ToString();
                litGia.Text = String.Format("{0:###,###,##0}", list[0].Gia) + " VNĐ";

                repeaterTourdocdao.DataSource = list;
                repeaterTourdocdao.DataBind();
            }
        }
        catch (Exception)
        {
            
            throw;
        }
    }

//    public void BindQuangCaoVYC1()
//    {
//        var id = GetIdQuangcaoVYC1(1);
//        if (id != 0)
//        {
//            var controller = new VYC06Controller();
//            var model = controller.GetBySubLoaiCm(id, 1);
//            if (model.Count > 0)
//            {
//                HyperLink1.NavigateUrl = model[0].LienKet;
//                HyperLink1.ToolTip = model[0].TieuDe;
//                Image1.ImageUrl = "~/Upload/tintuc/" + model[0].AnhDaiDien;
//                Image1.AlternateText = model[0].AnhDaiDien;
//            }
//        }
//        
//    }
//
//    public int GetIdQuangcaoVYC1(int number)
//    {
//        var controller = new VYC05Controller();
//        var model = controller.GetByUniqueId(Constants.SUB_QUANG_CAO + number);
//        if (model.Count > 0)
//            return model[0].Id;
//        return 0;
//    }

}